package com.ing.study.conf.controller;


import com.ing.study.conf.controller.entity.People;
import com.ing.study.conf.controller.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试多环境配置问题
 */
@RestController
@RequestMapping("config")
public class ConfigController {


    @Value("${server.port}")
    private String env;

    @Autowired
    User user;

    @Autowired
    People people;

    @RequestMapping("/getenv")
    public String getConf(){
        System.out.println(user.toString());
        return env;
    }

    @RequestMapping(path = {"/source"})
    public String getYml(){
        System.out.println(people.toString());
        return people.toString();
    }
}
